home *** CD-ROM | disk | FTP | other *** search
- //----------------------------------------------------------------------------------------
- // UTwistDownGlobals.h
- // ETO20 MacApp 3.3.1, MPW 3.4.1
- // Copyright ©1994-1996 Conrad Kopala
- // Twist Down Lists version 2.0a0 7/15/96
- //----------------------------------------------------------------------------------------
- #ifndef __UTWISTDOWNGLOBALS__
- #define __UTWISTDOWNGLOBALS__
-
- #ifndef __UTWISTDOWNAPP__
- #include "UTwistDownApp.h"
- #endif
-
- //MacApp stuff
- #ifndef __UMACAPPGLOBALS__
- #include "UMacAppGlobals.h"
- #endif
-
- #ifndef __UERRORMGR__
- #include "UErrorMgr.h" //to get value for messageLookup
- #endif
-
- #ifndef __UFAILURE__
- #include "UFailure.h"
- #endif
-
- //ToolBox stuff
- //None
-
- //ANSI stuff
- //None
-
- // My programs always include an AppGlobals.h file and an AppGlobals.r file.
- // The first part of the AppGlobals.h file parallels the AppGlobals.r file.
- // These two files define all command numbers, menu IDs, resource IDs, etc.
- // This approach to organizing program files arose out of development scenarios
- // involving multiple cooperative programs that share common files.
- // With it, I do not have to search through files to find these things
- // because I know where they are going to be defined. The risk of duplication and
- // confusion is minimized. For example, it is less likely with this approach that
- // something like kDefaultOKItemID will be defined more than once.
-
- //The following are also defined in TwistDownGlobals.r
- //----------------------------------------------------------------------------------------
- // Finder stuff
- //----------------------------------------------------------------------------------------
- const OSType kSignature = 'TDL%';
- const OSType kFileType = 'disk';
- const OSType kAETwistDownListsSuite = 'TDL%'; //AppleEvent class for TwistDownLists scripting support
- //----------------------------------------------------------------------------------------
- // AboutBoxIcon ID
- //----------------------------------------------------------------------------------------
- const ResNumber kAboutBoxIcon = 2000;
-
- //----------------------------------------------------------------------------------------
- // Menu IDs.
- //----------------------------------------------------------------------------------------
-
- const ResNumber mFormatMenu = 4;
- const ResNumber mControlMenu = 5;
- const ResNumber mWindowsMenu = 6;
- #if qDebug
- const ResNumber mTestMenu = 7;
- #endif
- const ResNumber mFontMenu = 8;
-
- //----------------------------------------------------------------------------------------
- // Command numbers For Menu Items
- //----------------------------------------------------------------------------------------
-
- const CommandNumber cExpandAll = 1000; //menu command number
- const CommandNumber cCollapseAll = 1001; //menu command number
- const CommandNumber cShowInvisibleFiles = 1002; //menu command number
- const CommandNumber cFailHere = 1003; //menu command number
- const CommandNumber cAllowUnlimitedDocs = 1004; //menu command number
-
- const CommandNumber cAppleEventRouting = 1100; //menu command number for toggle between SendToDoc and SendToView
- const CommandNumber cSendAppleEvents = 1101; //menu command number
-
- const CommandNumber cWritingDirection = 1110; //menu command number for toggle between LeftToRight and RightToLeft
- const CommandNumber cUseSystemDirection = 1111; //menu command number
-
- const CommandNumber cChangeWritingDirection = 1112; //used as common command number for TChangeWritingDirectionCommand
-
- //Change Font commands
- const CommandNumber cFont = 1750; //Font menu item & is for hierarchical sub-menu
- const CommandNumber cChangeFont = 1751; //used as common command number for TChangeFontCommand
-
- //Change Font-size commands
- const CommandNumber cLargerFontSize = 1761; //menu command number
- const CommandNumber cSmallerFontSize = 1762; //menu command number
- const CommandNumber cOtherFontSize = 1763; //menu command number
-
- const CommandNumber cChangeFontSize = 1764; //used as common command number for TChangeFontSizeCommand
-
- const CommandNumber cFontSizeBase = 1800;
- const CommandNumber cFontSizeMin = 1809;
- const CommandNumber cFontSizeMax = 1896;
-
- #if qDebug
- const CommandNumber cCountObjects = 1901; //menu command number
- const CommandNumber cResetObjectCount = 1902; //menu command number
- const CommandNumber cPrintBaseClassInfo = 1903; //menu command number
- const CommandNumber cPrintMacAppClassInfo = 1904; //menu command number
- const CommandNumber cPrintAppClassInfo = 1905; //menu command number
- const CommandNumber cAppUserFlag1 = 1906; //menu command number
- const CommandNumber cAppUserFlag2 = 1907; //menu command number
- const CommandNumber cAppUserFlag3 = 1908; //menu command number
- #endif
-
- //--------------------------------------------------------------------------------------------------
- // Other Command Numbers
- //--------------------------------------------------------------------------------------------------
-
- const CommandNumber cSplashScreen = 1950;
- const CommandNumber cExpandElement = 1951;
- const CommandNumber cCollapseElement = 1952;
- const CommandNumber cSetSearchMethod = 1953; //Required for TTwistDownDocument::GetSetPropertyInfo
- //--------------------------------------------------------------------------------------------------
- // AppleEvents for scripting support
- //--------------------------------------------------------------------------------------------------
- const ResNumber kTDLAEDispatchTable = 1000; //aedt resource
-
- //AppleEvent event IDs
- const OSType kAEExpandAllID = 'exAL'; // cExpandAll
- const OSType kAECollapseAllID = 'clAL'; // cCollapseAll
- const OSType kAEExpandElementID = 'exLI'; // cExpandElement
- const OSType kAECollapseElementID = 'clLI'; // cCollapseElement
-
- #if qDebug
- const OSType kAEResetObjectCountID = 'rsOC'; // cResetObjectCount
- #endif
-
- enum
- {
- cTwistDownView = 'TDvw', //class definition for the TTwistDownView
- cTwistDownElement = 'TDel' //class definition for the TTwistDownElement
- };
-
- enum
- {
- enumWritingDirection = 'WDir',
- kAELeftToRight = 'ltRT',
- kAERightToLeft = 'rtLT'
- };
-
- //Search method for finding things in the list
- enum
- {
- enumSearchMethod = 'SMth',
- kAEVisibleList = 'SVli',
- kAEWholeList = 'SWli'
- };
-
- //Apple Event routing
- enum
- {
- enumAERouting = 'EAEr',
- kAERouteToDoc = 'RDoc',
- kAERouteToView = 'RVew'
- };
-
- //properties of TTwistDownApp
- enum {
- pShowInvisibleFiles = 'SHin',
- pUseSystemDirection = 'usSD',
- pSendAppleEvents = 'snAE',
- pFailHere = 'FlHr',
- pAERouting = 'AERt',
- pUnlimitedDocs = 'ULDs'
- #if qDebug
- ,
- pObjectCountingEnabled = 'cObj',
- pPrBaseClassInfo = 'prBC',
- pPrMacAppClassInfo = 'prMA',
- pPrAppClassInfo = 'prAp',
- pSetAppUserFlag1 = 'sUF1',
- pSetAppUserFlag2 = 'sUF2',
- pSetAppUserFlag3 = 'sUF3'
- #endif
- };
-
- //properties of TTwistDownDocument
- enum {
- pNumFolders = 'Nfld', // number of folders in the twist down list
- pNumFiles = 'Nfil', // number of files in the twist down list
- pNumItems = 'Nitm', // sum of number of folders and number of files in the twist down list
- pSearchMethod = 'SMTH'
- };
-
- //properties of TTwistDownView
- enum {
- pWritingDirection = 'wDir',
- keyAEWritingDirection = 'wDIR',
- pCouldExpand = 'CDex', // fCouldExpand
- pCouldCollapse = 'CDcl', // fCouldCollapse
- pFontName = 'fntN'
- };
-
- //Properties for TTwistDownElement
- enum {
- pHasSubList = 'hsSL', //
- pShowSubList = 'shSL', //
- pHasControl = 'hsCT', //
- pItemInList = 'liTM', //Absolute position in the list
- pIndentLevel = 'INDT'
- };
-
- //----------------------------------------------------------------------------------------
- // Menu Items name str resource stuff for toggled commands
- //----------------------------------------------------------------------------------------
- const ResNumber kMenuNameStrings = 9999;
-
- //----------------------------------------------------------------------------------------
- // Menu Items name indices for toggled commands
- //----------------------------------------------------------------------------------------
- const short kLeftToRightNameIdx = 1;
- const short kRightToLeftNameIdx = 2;
- const short kRouteToDocNameIdx = 3;
- const short kRouteToViewNameIdx = 4;
-
- //----------------------------------------------------------------------------------------
- // Window and view resource IDs.
- //----------------------------------------------------------------------------------------
-
- const IDType kTwistDownViewID = 'SYVW';
- const IDType kChangeFontSizeViewID = 'SIZE';
- const IDType kSizeValueViewID = 'fsvl';
- const IDType kProgressViewID = 'prog';
- const IDType kProgressOperationViewID = 'Oper';
- const IDType kProgressSubjectViewID = 'Vol ';
- const IDType kProgressBarViewID = 'pBar';
- const IDType kAboutProgNameViewID = 'pNam'; //TStaticText ID for Program name in the about box
- const IDType kAboutCopyrightViewID = 'cprt'; //TStaticText ID for copyright in the about box
-
- const IDType kTwistDownControlViewID = 'TDct'; //Not really needed but useful when debugging
- //because it allows you to identify a twistDowncontrol.
-
- const ResNumber kAboutBoxWindowID = 2000;
- const ResNumber kTwistDownWindowID = 2002;
- const ResNumber kChangeFontSizeWindowID = 2003;
- const ResNumber kProgressWindowID = 2004;
-
- //----------------------------------------------------------------------------------------
- //Balloon help stuff.
- //----------------------------------------------------------------------------------------
- const ResNumber kChangeFontSizeDialogHelp = 3006;
- const ResNumber kTwistDowncontrolHelp = 3011;
- const ResNumber kProgressDialogHelp = 5001;
-
- const ResNumber kAppIconHelpStrings = 3000;
- const ResNumber kTDLMenuHelpStrings = 3001;
- const ResNumber kFormatMenuHelpStrings = 3002;
- const ResNumber kFontMenuHelpStrings = 3003;
- const ResNumber kSizeMenuHelpStrings = 3004;
- const ResNumber kWindowsMenuHelpStrings = 3005;
- const ResNumber kChangeFontSizeDialogHelpStrings = 3006;
- const ResNumber kWritingDirectionHelpStrings = 3007;
- const ResNumber kControlMenuHelpStrings = 3008;
- const ResNumber kAppleEventsHelpStrings = 3009;
-
- #if qDebug
- const ResNumber kTestMenuHelpStrings = 3010;
- #endif
- const ResNumber kTwistDownControlHelpStrings = 3011;
- const ResNumber kProgressDialogHelpStrings = 5001;
-
- //----------------------------------------------------------------------------------------
- // Error information.
- //----------------------------------------------------------------------------------------
- const ResNumber kErrorStrings = 6001;
- const long msgNotHFSVolume = messageLookup + -26002;
- const short errNotHFSVolume = -26002;
-
- const long msgAENotAFolder = messageLookup + -26003;
- const short errAENotAFolder = -26003;
-
- const long msgTooManyRows = messageLookup + -26004;
- const short errTooManyRows = -26004;
-
- const long msgCantExpandElement = messageLookup + -26005;
- const short errCantExpandElement = -26005;
-
- const long msgListAlreadyExpanded = messageLookup + -26006;
- const short errListAlreadyExpanded = -26006;
-
- const long msgListAlreadyCollapsed = messageLookup + -26007;
- const short errListAlreadyCollapsed = -26007;
-
- const long msgElementAlreadyExpanded = messageLookup + -26008;
- const short errElementAlreadyExpanded = -26008;
-
- const long msgElementAlreadyCollapsed = messageLookup + -26009;
- const short errElementAlreadyCollapsed = -26009;
-
- const long msgFailHere = messageLookup + -26010;
- const short errFailHere = -26010;
- //----------------------------------------------------------------------------------------
- // Other Constants #1
- //----------------------------------------------------------------------------------------
- const IDType kDefaultOKItemID = 'ok ';
- const IDType kCancelItemID = 'cncl';
- const IDType kStopItemID = 'stop';
-
- //End of items that are also defined in TwistDownGlobals.r
- //----------------------------------------------------------------------------------------
- // Other Constants #2
- //----------------------------------------------------------------------------------------
- const Boolean kHasSplashScreen = TRUE;
- const Boolean kHasAboutBox = TRUE; //not used yet
- const Boolean kForSplashScreen = TRUE;
- const Boolean kForAboutBox = !kForSplashScreen;
-
- const short kTriangleOutsideGap = 1;
- const short kTriangleInsideGap = 2;
-
- //The following constant is used to set the number of rows that TTextListView
- //will display. To test failure handling for the maximum number of rows that
- //can be displayed, set it to some small value. It can never be larger than kMaxShort;
- //Note that the object heap would have to expand to over 10mb in order to fill
- //TTextListView.
- const short kMaxNumberOfItemsToDisplay = kMaxShort;
- //----------------------------------------------------------------------------------------
- // Version stuff for the About Box
- //----------------------------------------------------------------------------------------
- const ResType kVersInfoType = 'vers';
- const ResNumber kVers1InfoID = 1;
-
- //----------------------------------------------------------------------------------------
- // Event Numbers.
- //----------------------------------------------------------------------------------------
- const short mExpandElement = 1000;
- const short mCollapseElement = 1001;
- const short mUpdateProgressBar = 1002;
-
- //----------------------------------------------------------------------------------------
- // For Script.h support.
- //----------------------------------------------------------------------------------------
- enum EWritingDirection
- {
- leftToRight = 0,
- rightToLeft = 1
- };
-
- enum EAppleEventRouting
- {
- routeToDoc = 0,
- routeToView = 1
- };
-
- enum ESearchMethod
- {
- visibleList = 0,
- wholeList = 1
- };
-
- //----------------------------------------------------------------------------------------
- // For object heap size management
- //----------------------------------------------------------------------------------------
- const long kFreeMemReserve = 300*1024;
- //----------------------------------------------------------------------------------------
- // externals
- //----------------------------------------------------------------------------------------
-
- extern FileFilterYDProcPtr gFileFilterYDProcPtr;
- extern DlgHookYDProcPtr gDlgHookYDProcPtr;
-
- //In a normal application the following three globals would be #if qDebug
- extern Boolean gFailHere;
- extern Boolean gSendAppleEvents;
- extern Boolean gUseSystemDirection;
- extern EAppleEventRouting gAppleEventRouting;
- //----------------------------------------------------------------------------------------
- // Globals functions defined in this unit.
- //----------------------------------------------------------------------------------------
-
- pascal Boolean MyCustomFileFilter(CInfoPBPtr PB, void *yourDataPtr);
- pascal short MyCustomDlgHook(short item, DialogPtr theDialog, void *yourDataPtr);
-
- short InitMaxObjectHeapSize();
- Boolean HaveObjectHeapSpace(long amountRequired);
- #endif